Biometrics

interface Biometrics

The Biometrics interface provides methods for detecting biometric availability, registering, authenticating, and removing biometrics identifiers.

Types

Link copied to clipboard
data class AuthenticateParameters(    val context: FragmentActivity,     val sessionDurationMinutes: UInt = Constants.DEFAULT_SESSION_TIME_MINUTES,     val promptData: Biometrics.PromptData? = null)

Data class used for wrapping parameters used with Biometrics authentication flow

Link copied to clipboard
data class PromptData(    val title: String,     val subTitle: String,     val negativeButtonText: String)

Data class used for wrapping parameters used to create a biometric prompt

Link copied to clipboard
data class RegisterParameters(    val context: FragmentActivity,     val sessionDurationMinutes: UInt = Constants.DEFAULT_SESSION_TIME_MINUTES,     val allowFallbackToCleartext: Boolean = false,     val promptData: Biometrics.PromptData? = null,     val allowDeviceCredentials: Boolean = false)

Data class used for wrapping parameters used with Biometrics registration flow

Functions

Link copied to clipboard
abstract fun areBiometricsAvailable(context: FragmentActivity, allowDeviceCredentials: Boolean = false): BiometricAvailability

Indicates if the biometric sensor is available, and provides a reasoning if not

Link copied to clipboard
abstract suspend fun authenticate(parameters: Biometrics.AuthenticateParameters): BiometricsAuthResponse
abstract fun authenticate(parameters: Biometrics.AuthenticateParameters, callback: (BiometricsAuthResponse) -> Unit)

If a valid biometric registration exists, this method confirms the current device owner via the device's built-in biometric reader and returns an updated session object by either starting a new session or adding the biometric factor to an existing session.

Link copied to clipboard
abstract fun isRegistrationAvailable(context: FragmentActivity): Boolean

Indicates if there is an existing biometric registration on device.

Link copied to clipboard
abstract fun isUsingKeystore(): Boolean

Indicates if the device is device has a reliable version of the Android KeyStore. If it does not, there may be issues creating encryption keys, as well as implications on where these keys are stored. The safest approach is to not offer biometrics if this returns false, but it is possible to force a registration with an unreliable KeyStore.

Link copied to clipboard
abstract suspend fun register(parameters: Biometrics.RegisterParameters): BiometricsAuthResponse
abstract fun register(parameters: Biometrics.RegisterParameters, callback: (BiometricsAuthResponse) -> Unit)

When a valid/active session exists, this method will add a biometric registration for the current user. The user will later be able to start a new session with biometrics or use biometrics as an additional authentication factor.

Link copied to clipboard
abstract suspend fun removeRegistration(): Boolean
abstract fun removeRegistration(callback: (Boolean) -> Unit)

Clears existing biometric registrations stored on device. Useful when removing a user from a given device. Returns true if the registration was successfully removed from device.